package ottawa.testing.validator;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
import ottawa.testing.bean.Provincia;

public class ProvinciaValidator 
	implements Validator
{

	protected final Log logger = LogFactory.getLog(getClass());
	
	public boolean supports(Class clazz) 
	{			
		return Provincia.class.equals(clazz);
	}

	public void validate(Object commandClass, Errors errors) 
	{			
		Provincia provincia = (Provincia) commandClass;
		if ( commandClass != null )
		{
		
			ValidationUtils.rejectIfEmptyOrWhitespace
				(errors, "nombreProvincia", "required", "El campo nombre provincia es obligatorio");
			
		}		
	}

}
